<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$title|default='访问受限'}</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            margin: 0;
            padding: 0;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .error-container {
            max-width: 500px;
            width: 90%;
            background: white;
            padding: 40px;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            text-align: center;
            animation: fadeInUp 0.6s ease-out;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .error-icon {
            font-size: 72px;
            color: #dc3545;
            margin-bottom: 20px;
            display: block;
        }
        
        .error-title {
            color: #333;
            font-size: 28px;
            font-weight: 600;
            margin-bottom: 15px;
            margin-top: 0;
        }
        
        .error-message {
            color: #666;
            font-size: 16px;
            line-height: 1.6;
            margin-bottom: 30px;
        }
        
        .error-actions {
            display: flex;
            gap: 15px;
            justify-content: center;
            flex-wrap: wrap;
        }
        
        .btn {
            display: inline-block;
            padding: 12px 24px;
            text-decoration: none;
            border-radius: 6px;
            font-weight: 500;
            transition: all 0.3s ease;
            border: none;
            cursor: pointer;
            font-size: 14px;
        }
        
        .btn-primary {
            background: #007bff;
            color: white;
        }
        
        .btn-primary:hover {
            background: #0056b3;
            transform: translateY(-1px);
        }
        
        .btn-secondary {
            background: #6c757d;
            color: white;
        }
        
        .btn-secondary:hover {
            background: #545b62;
            transform: translateY(-1px);
        }
        
        .error-details {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #eee;
            font-size: 12px;
            color: #999;
        }
        
        @media (max-width: 480px) {
            .error-container {
                padding: 30px 20px;
            }
            
            .error-title {
                font-size: 24px;
            }
            
            .error-actions {
                flex-direction: column;
            }
            
            .btn {
                width: 100%;
            }
        }
    </style>
</head>
<body>
    <div class="error-container">
        <div class="error-icon">🔒</div>
        <h1 class="error-title">{$title|default='访问受限'}</h1>
        <p class="error-message">
            {$message|default='您需要登录管理后台才能访问此页面。<br>请先登录管理员账户，然后重试。'}
        </p>
        
        <div class="error-actions">
            <a href="/admin/workbench" class="btn btn-primary">返回管理后台</a>
            <button onclick="history.back()" class="btn btn-secondary">返回上页</button>
        </div>
        
        <div class="error-details">
            <p>如果您认为这是一个错误，请联系系统管理员</p>
            <p>错误时间: {$Think.now|date='Y-m-d H:i:s'}</p>
        </div>
    </div>

    <script>
        // 自动刷新检查登录状态
        setTimeout(function() {
            if (document.referrer && document.referrer.indexOf('/adminapi') !== -1) {
                // 如果来源是管理后台，3秒后自动返回
                setTimeout(function() {
                    window.location.href = '/admin/workbench';
                }, 3000);
            }
        }, 1000);
    </script>
</body>
</html>
